import view
from civciv import static
from paste.session import SessionMiddleware

ABS_DIR = "/home/azer/Space/Dev/Web/multiplayerchess.org"
DEBUG = False

CHESS_SERVER = {
  "name":"local",
  "playerLimit":5,
  "location":"Istanbul",
  "ownerName":"Azer Koculu",
  "ownerLink":"http://azer.kodfabrik.com",
  "timeout":15000, # miliseconds,
  "masterUrl":"http://chess"
}

MIDDLEWARE_CLASSES = (
  SessionMiddleware,
)

urlpatterns = (
  (r'^/?$',view.form),
  (r'^/([\w-]{2,5})/?$',view.form),
  (r'^/user/login/?$',view.login),
  (r'^/user/logout/?$',view.logout),
  (r'^/table/list/callback=([\w\.]+)\&serverIndex=(\d+)?$',view.listGames),
  (r'^/table/create/callback=([\w\.\(\)]+)\&name=(\w+)\&location=(\w+)?$',view.createTable),
  (r'^/table/listenOpponent/callback=([\w\.\(\)]+)\&tableId=(\d+)',view.listenOpponent),
  (r'^/table/join/callback=([\w\.\(\)]+)\&name=(\w+)\&location=(\w+)\&tableId=(\d+)?$',view.joinTable),
  (r'^/table/move/tableId=(\d+)\&pieceId=(\d+)\&x=(\d+)\&y=(\d+)',view.move),
  (r'^/table/listenMove/callback=([\w\.\(\)]+)\&tableId=(\d+)\&mintime=(\d+)',view.listenMoves),
  (r'^/static/([\w\-\._\/]+)$',static("%s/static/"%ABS_DIR)),
  (r'^/sitemap.xml$',static("%s/sitemap.xml"%ABS_DIR))
)
